﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;

namespace RegistrationFormExercise
{
    public partial class MainPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ListBoxCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            while (this.CoursesResult.Items.Count != 0)
            {
                this.CoursesResult.Items.RemoveAt(0);
            }

            foreach (ListItem item in this.CoursesListBox.Items)
            {
                if (item.Selected == true)
                {
                    this.CoursesResult.Items.Add(new ListItem() { Value = item.Value, Text = item.Text });
                }
            }
        }

        protected void SubmitButtonClicked(object sender, EventArgs e)
        {
            string firstName = this.FirstName.Text;
            string lastName = this.LastName.Text;
            string facultyNumber = this.FacultyNumber.Text;
            string university = this.UniversityDropList.SelectedValue;

            this.FirstNameResult.InnerText = firstName;
            this.LastNameResult.InnerText = lastName;
            this.FacultyNumberResult.InnerText = facultyNumber;
            this.UniversityResult.InnerText = university;

            this.ResultDivision.Visible = true;

        }

    }
}